var app=getApp()
var that
Page({
  data: { 
    orders:[],
    sta:["","待发货","已发货","已收货","取消"],   
    order_ese:'',  //订单的快递信息
  },
  onLoad: function (options) {
    that=this;
    that.setData({ orderid: options.orderid})
    that.get_order_detail()
  },
  onShow: function () { 
  
  },
  get_order_detail:function(){ 
    app.req(app.local_url + "do=order&p=detail&id=id",
      { "od": app.data.openid, "id": that.data.orderid }, function (res) {
        // console.log(res)
        if (res.status == 1) {
          that.setData({ orders: res.result.goods, address: res.result.address, order_ese: res.result.order})
        } else if (res.status == 0) {
          app.toast_up(res.mess) 
        } else {
          app.modal("错误提示", "网络错误，是否重试？", function (re) {
            if (re) {
              that.get_order_detail()
            }
          })
        }
      })
  },
  shouhuo:function(){  //d点击确认收货
    app.req(app.local_url + "do=order&p=op&op=complete",
      { "od": app.data.openid, "orderid": that.data.order_ese.id }, function (res) {
        if (res.status == 1) {
          that.get_order_detail();  //重新获取，刷新
        } else if (res.status == 0) {
          app.toast_up(res.mess)
        } else {
          app.modal("错误提示", "网络错误，是否重试？", function (re) {
            if (re){
              that.shouhuo()
            }
          })
        }
      })
  },
  cellphone: function () {
    wx.makePhoneCall({
      phoneNumber: app.hotelData.house_notict.phone //真实的电话号码
    })
  },

})